package com.hyts.network.base;


import com.hyts.network.config.DefaultNetwork;

/**
 * project-name:gitee-extends-toolbox
 * package-name:com.hyts.ext.network.base
 * author:Libo/Alex
 * create-date:2018-10-27 11:50
 * copyright:libo-hyts-github
 * email:libo2dev@aliyun.com
 * description:此类主要用于:
 */
public abstract class ClientFactoryBean<T> {

    /**
     * field-name: ip
     * field-type: String
     * description: ip地址
     */
    private String ip;

    /**
     * field-name:port
     * field-type:int
     * description: 端口
     */
    private int port;

    /**
     * field-name:client
     * field-type:T
     * description: socket抽象模式
     */
    private T client;



    public ClientFactoryBean(String ip, int port) {
        this.ip = ip;
        this.port = port;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public int getPort() {
        return port;
    }

    public void setPort(int port) {
        this.port = port;
    }

    public ClientFactoryBean(String ip, int port, T client) {
        this.ip = ip;
        this.port = port;
        this.client = client;
    }

    public ClientFactoryBean(int port, T client) {
        this.ip = DefaultNetwork.DEFAULT_NETWORK_CYCYLE_IP;
        this.port = port;
        this.client = client;
    }

    public ClientFactoryBean(String ip, T client) {
        this.ip = ip;
        this.port = DefaultNetwork.DEFAULT_NETWORK_LOCAL_PORT;
        this.client = client;
    }

    public T getClient() {
        return client;
    }

    public void setClient(T client) {
        this.client = client;
    }

    public ClientFactoryBean(T client) {
        this.ip = DefaultNetwork.DEFAULT_NETWORK_CYCYLE_IP;
        this.port = DefaultNetwork.DEFAULT_NETWORK_LOCAL_PORT;
        this.client = client;
    }

    public ClientFactoryBean() {
        this.ip = DefaultNetwork.DEFAULT_NETWORK_CYCYLE_IP;
        this.port = DefaultNetwork.DEFAULT_NETWORK_LOCAL_PORT;
    }
}
